import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BizPriceAccessoryVo } from '@/api/operation/priceAccessory/types';

/**
 * 查询列表
 * @param query
 * @returns {*}
 */

export const listPriceAccessory = (query?: PageQuery): AxiosPromise<BizPriceAccessoryVo[]> => {
  return request({
    url: '/biz-vendor/priceAccessory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询详细
 * @param id
 */
export const getPriceAccessory = (id: string | number): AxiosPromise<BizPriceAccessoryVo> => {
  return request({
    url: '/biz-vendor/priceAccessory/' + id,
    method: 'get'
  });
};

/**
 * 新增
 * @param data
 */
export const addPriceAccessory = (data: BizPriceAccessoryVo) => {
  return request({
    url: '/biz-vendor/priceAccessory',
    method: 'post',
    data: data
  });
};

/**
 * 修改
 * @param data
 */
export const updatePriceAccessory = (data: BizPriceAccessoryVo) => {
  return request({
    url: '/biz-vendor/priceAccessory',
    method: 'put',
    data: data
  });
};

/**
 * 删除
 * @param id
 */
export const delPriceAccessory = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz-vendor/priceAccessory/' + id,
    method: 'delete'
  });
};

